<script setup lang="ts">
  import { buildStyles, getSize } from "../utils";

  interface DividerProps {
    width?: number | string;
  }

  const props = defineProps<DividerProps>();

  const styles = buildStyles(() => ({
    width: getSize(props.width),
  }));
</script>

<template>
  <div class="umrp-divider" :style="styles">
    <div class="umrp-divider-content">
      <slot></slot>
    </div>
  </div>
</template>

<style lang="scss" scoped>
  .umrp-divider {
    position: relative;
    display: flex;
    text-align: center;
    align-items: center;
    font-size: 12px;
    padding: 10px 0;

    &-content {
      padding: 0 10px;
    }

    &::before,
    &::after {
      display: block;
      content: " ";
      height: 1px;
      flex: 1;
      background-color: #f2f2f2;
      border-radius: 10px;
    }
  }
</style>
